﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 考核五
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

        private void Form2_Load(object sender, EventArgs e)
        {

        }

        private void Form2_KeyPress(object sender, KeyPressEventArgs e)
        {
            Graphics g = this.CreateGraphics();
            Pen pen = new Pen(Color.Black, 2);
            string flag=e.KeyChar.ToString();
            if (flag == "a")
            {
                Rectangle a = new Rectangle(100, 100, 100, 100);
                g.DrawEllipse(pen, a);
            }
            if(flag=="b")
            {
                Rectangle b = new Rectangle(110, 110, 100, 100);
                g.DrawRectangle(pen, b);
            }
            if (flag == "c")
            {
                Point pt1 = new Point(120, 120);
                Point pt2 = new Point(90, 45);
                Point pt3 = new Point(51, 60);
                g.DrawLine(pen, pt1.X, pt1.Y, pt2.X, pt2.Y);
                g.DrawLine(pen, pt1.X, pt1.Y, pt3.X, pt3.Y);
                g.DrawLine(pen, pt3.X, pt3.Y, pt2.X, pt2.Y);

            }
        }
    }
}
